# Copyright 2011 Bob Hepple. All rights reserved.

AC_INIT([scrmgr], [3.0], [bob.hepple@gmail.com])
AM_INIT_AUTOMAKE
DATE=`date`
AC_LANG_C

AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_PROG_INSTALL
# maybe use LT_INIT instead?:
AC_PROG_LIBTOOL
AC_PROG_RANLIB

AC_PROG_CC_C_O
AM_PROG_CC_C_O

# Check for system header files
AC_HEADER_STDC
AC_CHECK_HEADERS(stdio.h string.h stdlib.h stdarg.h ctype.h unistd.h)
AC_CHECK_HEADERS(sys/mman.h stdint.h errno.h fcntl.h sys/stat.h sys/types.h)

# Check whether to include debugging code
DEBUG=""
AC_MSG_CHECKING([whether to include verbose debugging code])
AC_ARG_ENABLE(debug,
  [  --enable-debug          include verbose debugging code [default=no]],
  if test x$enableval = "xyes"; then
    AC_MSG_RESULT([yes])
    DEBUG="-O0 -DDEBUG -Wall -Werror -fno-inline"
  else
    AC_MSG_RESULT([no])
  fi,
  AC_MSG_RESULT([no])
)
AC_SUBST(DEBUG)
CFLAGS="$CFLAGS $DEBUG"

# Print results
AC_MSG_RESULT([])
AC_MSG_RESULT([	$PACKAGE version $VERSION configured successfully.])
AC_MSG_RESULT([])
AC_MSG_RESULT([Using '$prefix' for installation.])
AC_MSG_RESULT([Using '$CC' for C compiler.])
AC_MSG_RESULT([Building with '$CFLAGS' for C compiler flags.])
AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
AC_MSG_RESULT([])

AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(DATE)
AC_CONFIG_FILES([
        Makefile 
        scrmgr.spec
        src/Makefile 
        src/tools/Makefile
        doc/Makefile 
])
AC_OUTPUT
